import java.util.Scanner;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        //给数组赋值
        for(int i = 0; i < arr.length; i++){
            arr[i] = sc.nextInt();
        }
        int count = 1; //计算子序列个数，初始值为1，比如只有123
        int flag = 0; //子序列标志位
        for(int i = 1; i < arr.length; i++){
            //递增序列
            if(arr[i] > arr[i-1]){
                if(flag == 0 || flag == 1){
                    flag = 1;
                }
                if(flag == -1){
                    flag = 0;
                    count++;
                }
            }
            
            //递减序列
            if(arr[i] < arr[i-1]){
                if(flag == 0 || flag == -1){
                    flag = -1;
                }
                if(flag == 1){
                    flag = 0;
                    count++;
                }
            }
        }
        System.out.println(count); //输出子序列个数
    }
}